<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 墨墨之家
  Date: 2021/11/7
  Time: 15:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <%@include file="/WEB-INF/common/head.jsp" %>
    <script type="text/javascript">
        $(function () {
            $("#toRightBtn").click(function () {
                $("select:eq(0)>option:selected").appendTo("select:eq(1)");
            })
            $("#toLeftBtn").click(function () {
                $("select:eq(1)>option:selected").appendTo("select:eq(0)");
            })
            $("#submitBtn").click(function () {
                // $("[name=roleIdList] option").prop("selected", selected);
                // prop 括号里的值一定要加“”！！！！！！！！
                $("select:eq(1) option").prop("selected", "selected");
            })
            $("#backBtn").click(function () {
                window.history.back();
                return false;
            })
        })
    </script>
</head>
<body>
<%--静态包含--%>
<%@include file="/WEB-INF/common/nav.jsp" %>

<div class="container-fluid">
    <div class="row">
        <%--静态包含--%>
        <%@include file="/WEB-INF/common/sidebar.jsp" %>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            <ol class="breadcrumb">
                <li><a href="index.jso">首页</a></li>
                <li><a id="backBtn" href="">数据列表</a></li>
                <li class="active">分配角色</li>
            </ol>

            <div class="panel panel-default">
                <div class="panel-body">
                    <form action="assign/to/admin.html" role="form" class="form-inline">
                        <input type="hidden" name="pageNum" value="${param.pageNum}"/>
                        <input type="hidden" name="keyword" value="${param.keyword}"/>
                        <input type="hidden" name="adminId" value="${param.adminId}"/>
                        <div class="form-group">
                            <label>未分配角色列表</label><br>
                            <select class="form-control" multiple size="10" style="width:100px;overflow-y:auto;">
                                <c:forEach items="${requestScope.unAssignedRoles}" var="role">
                                    <option value="${role.id}">${role.name}</option>
                                </c:forEach>
                            </select>
                        </div>
                        <div class="form-group">
                            <ul>
                                <li id="toRightBtn" class="btn btn-default glyphicon glyphicon-chevron-right"></li>
                                <br>
                                <li id="toLeftBtn" class="btn btn-default glyphicon glyphicon-chevron-left"
                                    style="margin-top:20px;"></li>
                            </ul>
                        </div>
                        <div class="form-group" style="margin-left:40px;">
                            <label>已分配角色列表</label><br>
                            <select name="roleIdList" class="form-control" multiple size="10"
                                    style="width:100px;overflow-y:auto;">
                                <c:forEach items="${requestScope.assignedRoles}" var="role">
                                    <option value="${role.id}">${role.name}</option>
                                </c:forEach>
                            </select>
                            <input id="submitBtn" type="submit" value="提交">
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>


</body>
</html>
